<template>
    <header>
        <nav>
            <div class="nav-content gWidth clearfix">
                <div class="logo-box fl">
                    <a href="index.html">
                        <img src="static/images/hnist-logo.png" class="logo fl">
                        <h1 class="fl">湖南理工学院校友会</h1>
                    </a>
                </div>
                <div class="menu-box fl">
                    <!--一级菜单-->
                    <ul class="menu-one clearfix">
                        <li v-for="menuOne in headMenuTree.children" :key="menuOne.id">
                            <menu-router :menu="menuOne">{{menuOne.name}}</menu-router>
                            <!--二级菜单-->
                            <ul class="menu-two clearfix" >
                                <menu-router v-for="menuTwo in menuOne.children" :key="menuTwo.id" :menu="menuTwo"><li>{{menuTwo.name}}</li></menu-router>
                            </ul>
                        </li>
                    </ul>
                </div>
                <div class="account-box fr clearfix">
                    <router-link to="/index/account">登陆</router-link>
                    <a href="#">加入</a>
                </div>
                
            </div>
        </nav>
    </header>

</template>

<script>
    import { mapGetters, mapActions } from 'vuex'
    import menuRouter from '../components/menu/menu-router'
    export default {
        name: "my-header",
        computed: mapGetters({
            headMenuTree:'headMenuTree'
        }),
        components:{
            'menu-router':menuRouter
        }
    }
</script>

<style scoped>
    /* nav */
    header nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 70px;
        width: 100%;
        background-color: #f0f8ffdd;
        box-sizing: padding-box;
        box-shadow: 0 10px 20px;
        border-top: 10px solid #004a98;
        z-index: 100;
    }

    header nav .nav-content {
        margin: 0 auto;
    }

    /*nav-logo*/
    header nav .nav-content .logo-box {
        width: 400px;
        margin-right: 20px;
    }

    header nav .nav-content .logo-box .logo {
        height: 70px;
        padding: 10px;
        box-sizing: border-box;
    }

    header nav .nav-content .logo-box h1 {
        height: 70px;
        line-height: 70px;
        color: black;
        font-family: 华文新魏;
        font-size: 30px;
    }

    /*nav menu*/
    header nav .nav-content .menu-box .menu-one > li {
        float: left;
        height: 70px;
        width: 120px;
        line-height: 70px;
        font-size: 16px;
        transition: background-color 500ms 0s;
        text-align: center;
    }

    header nav .nav-content .menu-box .menu-one > li > a {
        color: black;
        transition: color 500ms 0s;
    }

    header nav .nav-content .menu-box .menu-one > li:hover {
        background-color: #004a98;
        color: white;
    }

    header nav .nav-content .menu-box .menu-one > li:hover > a {
        color: white;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two li {
        transform: rotateY(180deg);
        height: 0;
        width: 120px;
        text-align: center;
        line-height: 0px;
        margin-top: 2px;
        background-color: #004a98dd;
        box-sizing: border-box;
        opacity: 0;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two li {
        color: #00000000;
    }

    header nav .nav-content .menu-box .menu-one > li:hover .menu-two li {
        transform: rotateY(360deg);
        height: 50px;
        line-height: 50px;
        opacity: 1;
    }

    header nav .nav-content .menu-box .menu-one > li:hover .menu-two li {
        color: white;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(1)>li {
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 100ms, 100ms, 0s;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(2)>li {
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 200ms, 200ms, 0s;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(3)>li {
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 300ms, 300ms, 0s;
    }
    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(4)>li {
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 400ms, 400ms, 0s;
    }
    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(5)>li{
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 500ms, 500ms, 0s;
    }
    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(6)>li{
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 600ms, 600ms, 0s;
    }
    header nav .nav-content .menu-box .menu-one > li .menu-two>a:nth-of-type(7)>li{
        transition-property: transform, opacity, background-color;
        transition-duration: 500ms, 500ms, 500ms;
        transition-delay: 700ms, 700ms, 0s;
    }

    header nav .nav-content .menu-box .menu-one > li .menu-two li:hover {
        background-color: #004a9899;
    }

    /*nav account box*/
    header nav .nav-content .account-box > a {
        font-size: 12px;
        float: left;
        display: block;
        height: 35px;
        line-height: 35px;
        color: white;
        text-align: center;
        width: 70px;
        margin-top: calc((70px - 35px) / 2);
        box-sizing: border-box;
        margin-right: 10px;
        background-color: #004a98dd;

    }

    header nav .nav-content .account-box > a:hover {
        background-color: #004a9899;
    }

</style>
